///<reference path="../typings/index.d.ts"/>
import http = require("http");
import fs = require("fs");
import socketIO = require("socket.io");
export class FMServer{
    private resonseContent:Buffer = null;
    private socketIO:SocketIO.Server = null;
    initServer():void{
      const httpClient =  http.createServer((request,response)=>{
      //  response.writeHead(200, {'Content-Type': 'text/plain'});
          this.readContent();
        response.write(this.resonseContent);
        response.end();
      }).listen(8090);
       const socketServer =  socketIO.listen(httpClient);
       socketServer.on("connect",(socket)=>{
          console.log("socket client connected");
       });
      
      console.log("init server done");

    }
    readContent():void{
        const path = __dirname + "\\" + "chrome-notifiction.html"
        this.resonseContent  =  fs.readFileSync(path);

    }
}

const fmserver  = new FMServer();
fmserver.readContent();
fmserver.initServer();

